package com.briup.recognition.web.controller;

import com.briup.recognition.bean.BasePrivilege;
import com.briup.recognition.service.BasePrivilegeService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 冯琼华
 * @Date: 2021/03/28/20:20
 * @Description:
 */

@RestController
@RequestMapping("/basePrivilege")
public class BasePrivilegeController {
    @Autowired
    private BasePrivilegeService basePrivilegeService;

    @GetMapping("query")
    public Message query(){
        List<BasePrivilege> list= basePrivilegeService.query();
        return MessageUtil.success(list);
    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BasePrivilege basePrivilege){
        basePrivilegeService.saveOrUpdate(basePrivilege);
        return MessageUtil.success("操作成功");
    }

    @DeleteMapping("deleteBPSid")
    public Message deleteBPSid(long id){
        basePrivilegeService.deleteBPSid(id);
        return MessageUtil.success("删除成功");
    }

}
